Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
The remark npm package is a powerful, extensible Markdown processor built on the unified collective ecosystem. It allows for parsing, transforming, and compiling Markdown content with a focus on syntax trees. Remark can be used for a variety of tasks such as linting Markdown, transforming the syntax for different purposes, or extracting metadata from documents.
Parsing Markdown to Syntax Trees
This feature allows users to parse Markdown content into an abstract syntax tree (AST), enabling programmatic analysis and manipulation of the content.
const remark = require('remark');
const markdown = 'Some **Markdown** text.';
remark().parse(markdown);
Transforming Syntax Trees
With this feature, users can transform the syntax tree generated from Markdown content. For example, converting the tree to HTML by using the remark-html plugin.
const remark = require('remark');
const html = require('remark-html');
const markdown = 'Some **Markdown** text.';
remark().use(html).processSync(markdown).toString();
Linting Markdown
This feature enables users to lint their Markdown content for style and syntax issues, ensuring consistency and quality in their Markdown files.
const remark = require('remark');
const recommended = require('remark-preset-lint-recommended');
const report = require('vfile-reporter');
remark().use(recommended).process('_Emphasis_ and **importance**', (err, file) => {
console.error(report(err || file));
});
markdown-it is a fast and extensible Markdown parser that can render HTML. It is similar to remark in its extensibility but focuses more on speed and adherence to the CommonMark specification without an emphasis on abstract syntax trees.
showdown is another Markdown to HTML converter that can run both in the browser and on the server. Unlike remark, which is built around a plugin ecosystem and AST manipulation, showdown focuses on configurability and extension through a different type of extension mechanism.
marked is a low-level Markdown compiler for parsing Markdown without caching or blocking for files. It is designed for speed and is simpler in scope compared to remark, which offers a broader range of processing capabilities through its plugins and unified ecosystem.
unified processor to parse and serialize Markdown. Built on micromark. Powered by plugins. Part of the unified collective.
remark-parse
remark-stringify
Don’t need the parser? Or compiler? That’s OK: use unified directly.
npm:
npm install remark
See unified for more examples »
This example lints Markdown and turns it into HTML.
var remark = require('remark')
var recommended = require('remark-preset-lint-recommended')
var html = require('remark-html')
var report = require('vfile-reporter')
remark()
.use(recommended)
.use(html)
.process('## Hello world!', function (err, file) {
console.error(report(err || file))
console.log(String(file))
})
Yields:
1:1 warning Missing newline character at end of file final-newline remark-lint
⚠ 1 warning
<h2>Hello world!</h2>
This example prettifies Markdown and configures remark-stringify
through data.
var remark = require('remark')
remark()
.data('settings', {emphasis: '*', strong: '*'})
.process('_Emphasis_ and __importance__', function (err, file) {
if (err) throw err
console.log(String(file))
})
Yields:
*Emphasis* and **importance**
This example prettifies Markdown and configures remark-parse
and
remark-stringify
through a preset.
var remark = require('remark')
remark()
.use({settings: {emphasis: '*', strong: '*'}})
.process('_Emphasis_ and __importance__', function (err, file) {
if (err) throw err
console.log(String(file))
})
Yields:
*Emphasis* and **importance**
As Markdown is sometimes used for HTML, and improper use of HTML can open you up
to a cross-site scripting (XSS) attack, use of remark can also be unsafe.
When going to HTML, use remark in combination with the rehype
ecosystem, and use rehype-sanitize
to make the tree safe.
Use of remark plugins could also open you up to other attacks. Carefully assess each plugin and the risks involved in using them.
See contributing.md
in remarkjs/.github
for ways
to get started.
See support.md
for ways to get help.
Ideas for new plugins and tools can be posted in remarkjs/ideas
.
A curated list of awesome remark resources can be found in awesome remark.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
Support this effort and give back by sponsoring on OpenCollective!
Gatsby 🥇 |
Vercel 🥇 |
Netlify |
Holloway |
ThemeIsle |
Boost Hub |
Expo |
You? |
FAQs
markdown processor powered by plugins part of the unified collective
The npm package remark receives a total of 1,594,517 weekly downloads. As such, remark popularity was classified as popular.
We found that remark demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.